<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>商品管理 - 商品品牌</title>
<?php include($this->c['_homes']['_viewsHome'].'/_global/_head.php');?>
</head>
<!-- BEGIN BODY -->
<body class="page-header-fixed page-sidebar-fixed">
<!-- BEGIN HEADER -->
<?php include($this->c['_homes']['_viewsHome'].'/_global/head.php');?>
<!-- END HEADER -->
<div class="clearfix"></div>
<!-- BEGIN CONTAINER -->
<div class="page-container" > 
  <!-- BEGIN HORIZONTAL MENU PAGE SIDEBAR1 -->
  <?php include($this->c['_homes']['_viewsHome'].'/_global/menu.php');?>
  <!-- END BEGIN HORIZONTAL MENU PAGE SIDEBAR --> 
  <!-- BEGIN PAGE -->
  <div class="page-content"> 
    <!-- BEGIN PAGE HEADER-->
    <div class="row">
      <div class="col-md-12"> 
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title"> 商品品牌 </h3>
        <ul class="page-breadcrumb breadcrumb">        
          <li class="btn-group">
            <button type="button" class="btn blue dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true"> <span>操作</span> <i class="icon-angle-down"></i> </button>
            <ul class="dropdown-menu pull-right" role="menu">
				    <li><a href="/channel/brand_add"><i class="icon-plus"></i> 新增品牌</a></li>
            </ul>
          </li>
          <li> <i class="icon-home"></i> <a href="/manage">后台</a> <i class="icon-angle-right"></i> </li>
          <li> 商品管理 <i class="icon-angle-right"></i> </li>
          <li>商品品牌</li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB--> 
      </div>
    </div>
    <!-- END PAGE HEADER--> 
    <!-- BEGIN PAGE CONTENT-->
    <div class="row">
            <div class="col-md-12">
                <div class="portlet box">
                    <div class="booking-search">
                        <form action="" role="form" method="get">
                            <div class="row form-group">
                                <div class="col-md-3">
                                    <div class="input-cont">
                                        <input class="form-control" name="keyword" placeholder="请输入品牌中文/英文名称"
                                               value="<?= $_GET['keyword']; ?>" type="text">
                                    </div>
                                </div>
                              <div class="col-md-2">
                  <select class="form-control" name="caid" id="caid">
                      <option value="">选择国家</option>
                      <?php
                      if($this->classlist[0]){
                          foreach($this->classlist[0] as $k=> $r){
                              if(isset($this->data['para']['caid']) && $r['caid']==$this->data['para']['caid']) $slk = ' selected';
                              else $slk = '';
                              $newclasslist[$r['caid']] = $r['name'];
                              ?>
                              <option value="<?=$r['caid'];?>"<?=$slk;?>><?=$r['name'];?></option>
                              <?
                          }
                      }
                      ?>
                  </select>
              </div>
                              <div class="col-md-2">
                                  <select class="form-control" name="stat">
                                        <option value="">全部状态</option>
      
                                         <option value="1"<? if ($_GET['stat'] == "1") echo ' selected'; ?>>
                                            正常
                                        </option>
                                        <option value="2"<? if ($_GET['stat'] == "2") echo ' selected'; ?>>
                                            禁用
                                        </option>
                                        <option value="3"<? if ($_GET['stat'] == "3") echo ' selected'; ?>>
                                            已删除
                                        </option>
                                    </select>
                                </div>
                            
                                <div class="col-md-1"><input type="submit" class="btn blue btn-block" value="搜 索"></div>
                            </div>
            
                         </form>
               
                    </div>
                </div>
            </div>
           
        </div>

    <div class="row">
      <div class="col-md-8"> 
        <!-- BEGIN SAMPLE TABLE PORTLET-->
        <div class="portlet box blue">
          <div class="portlet-title">
            <div class="caption"><i class="icon-reorder"></i>列表</div>
            <div class="tools"> <a href="javascript:;" class="collapse"></a> </div>
          </div>
          <div class="portlet-body">
            <table class="table table-hover">
              <thead>
                <tr>
                  <th>中文名称</th>
                  <th>英文名称</th>
                  <th>权重</th>
                  <th>国家</th>
                  <th>状态</th>
                  <th>品牌LOGO</th>
                  <th>品牌广告</th>
                  <th>操作</th>
                </tr>
              </thead><tbody>
              <?php
			         if($this->data['data']){
				        foreach($this->data['data'] as $k=>$r){
					     ?>	
                    <tr>                    
                    <td><?=$r['name'];?></td>
                    <td><?=$r['names'];?></td>
                    <td><?=$r['weight'];?></td>
                    <td><?=$newclasslist[$r['caid']];?></td>
                    <td><?=$this->c['stat']['normal'][$r['stat']];?></td>
                    <td><?=$r['brand_pic'] > 0 ? $this->c['stat']['yesno'][1] : $this->c['stat']['yesno'][0];?></td>
                    <td><?=$r['cover_pic'] > 0 ? $this->c['stat']['yesno'][1] : $this->c['stat']['yesno'][0];?></td>
                    <td>
                        <a href="/channel/brand_edit?brand_id=<?=$r['brand_id'];?>" class="btn btn-xs blue"><i class="icon-edit"></i> 编辑</a>  
                        <a href="#portlet-config" data-toggle="modal" onclick="_delete_alert(<?=$r['brand_id']?>);" class="btn btn-xs red"><i class="icon-remove"></i> 删除</a>
                    </td>
                    </tr>        
                <?
        				  }
        			  }
        			  ?>
              </tbody>
            </table>
          </div>
        </div>
        <!-- END SAMPLE TABLE PORTLET--> 
      </div>
    </div>
    <!-- END PAGE CONTENT--> 
  </div>
  <!-- END PAGE --> 
</div>
<!-- END CONTAINER -->
    <!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
    <div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
            <h4 class="modal-title">Modal title</h4>
          </div>
          <div class="modal-body"> Widget settings form goes here </div>
          <div class="modal-footer">
            <button type="button" class="btn blue submit_btn">确定</button>
            <button type="button" class="btn default" data-dismiss="modal">取消</button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
    <!-- /.modal --> 
<!-- END CONTAINER -->
<?php include($this->c['_homes']['_viewsHome'].'/_global/_footer.php');?>
<script>
    jQuery(document).ready(function() {    
       App.init();
       var _submit_action = '',_dataid = 0;
      $(".submit_btn").bind("click",function(){
        var id=$(".submit_btn").attr("delid");
          _delete(id);
      });
    });

function _delete(id){
  $.post("/channel/ajax",{"act":"delete","brand_id":parseInt(id),"mr":Math.random()},function(msg){

    data=eval("("+msg+")");
    if(data.code==200){
      window.location.reload(); 
    }
  });

}
function _delete_alert(dataid){
  _submit_action = 'delete';
  _dataid = dataid;
  $(".submit_btn").attr("delid",dataid);
  $("#portlet-config .modal-title").html('删除品牌');
  $("#portlet-config .modal-body").html('<p>确定删除此品牌吗？</p> <p class="alert alert-danger">警告：删除后不可恢复</p>'); 
}
  </script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>